package FileHandler ; 
require Exporter;

use strict ; use warnings  ; 

# @ISA = qw(AutoLoader Exporter);
my @EXPORT = qw(ReadFileReturnString );


my $confHolder = () ; 

sub ReadFileReturnString {
	my $self = shift ; 
	my $fileToRead = shift ; 

	print " readFileReturnString \$fileToRead is $fileToRead \n" ; 
	
	#todo: detect whether the file is utf8 encoded 

	#how-to slurp file
	my $string = (); 
	{
		local $/=undef;

		#all resx files are utf8 encoded !!!		
		if ( $fileToRead =~ m/resx/gi )
			{		
			open FILE, "<:utf8", "$fileToRead " or print STDERR "Couldn't open \$fileToRead $fileToRead : $!"; 
			$string = <FILE>;
			print "UTF8 STRING IS " . $string ; 
			
			}
		else 
			{ 	open FILE, "$fileToRead " or print STDERR "Couldn't open \$fileToRead $fileToRead : $!"; 
					$string = <FILE>;
			}
		
		
		close FILE;
	}
	return $string ; 
} #eof sub readFileReturnString 
# =========================================== eof sub readFileReturnString 



# =============================================================================
# START OO


# the constructor 
sub new	{
	my $self = shift;
	#get the has containing all the settings
	#if ( @_ ) { $confHolder = ${ shift @_ } ; 	}
	return bless({}, $self);
} #eof new 


sub AUTOLOAD {
	my $self = shift ; 
	no strict 'refs'; 
    my $name = our $AUTOLOAD;
    *$AUTOLOAD = sub { 
	my $msg = "BOOM! BOOM! BOOM! \n RunTime Error !!!\nUndefined Function $name(@_)\n" ;
	print "$self , $msg";
    };
    goto &$AUTOLOAD;    # Restart the new routine.
}	

sub DESTROY {
	my $self = shift;
	#debug print "the DESTRUCTOR is called  \n" ; 
	return ; 
} 

# STOP OO
# =============================================================================

1;

__END__


#	This package is responsible for reading the ini-files
#	it is used by every other application and module in the project
#use vars qw(%variables);

